package cn.jxau.fukin.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.jxau.fukin.dao.DiaryMapper;
import cn.jxau.fukin.model.Diary;
import cn.jxau.fukin.service.IDiaryService;
import cn.jxau.fukin.util.DateTimeUtil;

@Service("diaryService")
public class DiaryService implements IDiaryService {
	@Autowired
	DiaryMapper diaryMapper;
	
	public void insertDiary(Diary diary){
		if(diary == null)
			return;
		List<String> dayAndMinute = DateTimeUtil.getDayAndMinute();
		diary.setdDay(dayAndMinute.get(0));
		diary.setdMinute(dayAndMinute.get(1));
		diaryMapper.insert(diary);
	}
	
	public List<Diary> selectAllDiarys(){
		return diaryMapper.selectAllDiarys();
	}
}
